import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'Home',
    component: Home
  },
  {
    path: '/about',
    name: 'About',
    component: () => import('../views/About.vue'),
    redirect: '/dashboard',
    children: [
      // 首页
      {
        path: '/dashboard',
        name: 'dashboard',
        component: () => import('../views/list/dashboard.vue')
      },
      // 商品分类
      {
        path: '/permission',
        name: 'permission',
        component: () => import('../views/list/shoplist/permission.vue')
      },
      // 由商品分类进入商品详情
      {
        path: '/permissions',
        name: 'permissions',
        component: () => import('../views/list/shoplist/permissions.vue'),
      },
      {
        path: '/productHand',
        name: "productHand",
        component: () => import("../views/list/shoplist/productHand.vue")
      },
      // 添加商品
      {
        path: '/add',
        name: "add",
        component: () => import("../views/list/shoplist/add.vue")
      },
      // 编辑商品
      {
        path: '/edit',
        name: "edits",
        component: () => import("../views/list/shoplist/edit.vue")
      },
      // 商品
      {
        path: '/shops',
        name: 'shops',
        component: () => import('../views/list/category/shops.vue')
      },
      {
        path: '/addshop',
        name: 'addshop',
        component: () => import('../views/list/category/addshop.vue')
      },
      {
        path: '/chashop',
        name: 'chashop',
        component: () => import('../views/list/category/chashop.vue')
      },
      {
        path: '/order',
        name: 'order',
        component: () => import('../views/list/dingdan/order.vue')
      },
      {
        path: '/chaorder',
        name: 'chaorder',
        component: () => import('../views/list/dingdan/chaorder.vue')
      }
    ]
  },

]
// 配置公共路径，超出时间
const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
